<layout-header></layout-header>

<nav class="container-xl mb-3">
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a routerLink="/welcome">首页</a></li>
        <li class="breadcrumb-item"><a routerLink="/chatroom/list">群聊配置</a></li>
        <li class="breadcrumb-item active">修改</li>
    </ol>
</nav>

<div class="container-xl mb-3">
    <form class="row gy-3" (ngSubmit)="updateChatroom()" #myform="ngForm">
        <div class="col-12">
            <label class="form-label">群聊 *</label>
            <select name="roomid" class="form-select" [(ngModel)]="formdata.roomid" required>
                @for (item of wcfChatrooms; track item.wxid) {
                <option [value]="item.wxid">{{item.name}}</option>
                }
            </select>
            <div class="form-text">
                选择一个需要关联的群聊
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">别名</label>
            <input type="text" name="name" class="form-control" [(ngModel)]="formdata.name" />
            <div class="form-text">
                用于显示简要名称，生成加群指令中的描述
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">级别 *</label>
            <select name="level" class="form-select" [(ngModel)]="formdata.level" required>
                @for (item of roomLevels | keyvalue; track item.key) {
                <option [value]="item.key">{{item.value.name}}</option>
                }
            </select>
            <div class="form-text">
                用于适配机器人使用权限
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">加群指令</label>
            <input type="text" name="join_argot" class="form-control" [(ngModel)]="formdata.join_argot" />
            <div class="form-text">
                用于生成加群指令，最少2位字符，“-” 表示不启用
                @if (formdata.join_argot && formdata.join_argot.length > 1) {
                【 注册指令 <b>/jr:{{formdata.join_argot}}</b> 】
                }
            </div>
        </div>

        <div class="col-12">
            <label class="form-label">默认模型</label>
            <select name="model_default" class="form-select" [(ngModel)]="formdata.model_default">
                @for (item of llmodels; track item.rd) {
                <option [value]="item.mid">{{item.mid}}（{{item.model}}）</option>
                }
            </select>
            <div class="form-text">
                设置默认模型，优先级大于全局
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">模型角色设置</label>
            <textarea name="model_context" class="form-control" [(ngModel)]="formdata.model_context"></textarea>
            <div class="form-text">
                设置模型默认角色，优先级大于全局
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">模型最大上下文</label>
            <input type="number" name="model_history" class="form-control" [(ngModel)]="formdata.model_history" />
            <div class="form-text">
                设置模型最大上下文，优先级大于全局
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">回应拍拍</label>
            <select name="pat_return" class="form-select" [(ngModel)]="formdata.pat_return">
                <option value="true">是</option>
                <option value="false">否</option>
            </select>
            <div class="form-text">
                是否自动回应“拍了拍我”，拍一拍对方
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">欢迎信息</label>
            <input type="text" name="welcome_msg" class="form-control" [(ngModel)]="formdata.welcome_msg" />
            <div class="form-text">
                用户入群时的欢迎信息，最少2位字符，“-” 表示不启用
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">撤回提醒</label>
            <input type="text" name="revoke_msg" class="form-control" [(ngModel)]="formdata.revoke_msg" />
            <div class="form-text">
                检测到撤回消息时的提醒，最少2位字符，“-” 表示不启用
            </div>
        </div>
        <div class="col-12">
            <label class="form-label">备注</label>
            <input type="text" name="remark" class="form-control" [(ngModel)]="formdata.remark" />
            <div class="form-text">
                备注信息
            </div>
        </div>
        <div class="col-12">
            <button type="submit" class="btn btn-primary" [disabled]="myform.invalid">确认</button>
        </div>
    </form>
</div>